package com.fivemin.website_statistics.controller;

import com.fivemin.website_statistics.dao.WebUserMapper;
import com.fivemin.website_statistics.pojo.WebUser;
import com.fivemin.website_statistics.service.WebUserService;
import com.fivemin.website_statistics.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;

@RestController
@CrossOrigin
public class WebUserController {
    @Autowired
    private WebUserService webUserService;

    @PostMapping("/webUser/add")
    public R addWebUser(@RequestBody @Validated WebUser webUser) {
        return webUserService.addWebUser(webUser);
    }

    @GetMapping("/webUser/list")
    public R getWebUserList(@RequestParam("pageNum") int pageNum,@RequestParam("pageSize")int pageSize) {
        return webUserService.getWebUserList(pageNum,pageSize);
    }

    @GetMapping("/webUser/disable")
    public R disableWebUserById(@RequestParam("id") int id) {
        return webUserService.disableWebUserById(id);
    }
}
